<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/roee/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/roee/lib/pace/pace-theme-flash.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/roee/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/roee/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/roee/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="ReactNative,JavaScript," />








  <link rel="shortcut icon" type="image/x-icon" href="/roee/favicon.ico?v=5.1.2" />






<meta name="description" content="ReactNative使用Code-Push集成热更新">
<meta name="keywords" content="ReactNative,JavaScript">
<meta property="og:type" content="article">
<meta property="og:title" content="ReactNative热更新初探">
<meta property="og:url" content="http://rjll.gitee.io/roee/2018/04/24/ReactNative热更新初探/index.html">
<meta property="og:site_name" content="Roee&#39;s Blog">
<meta property="og:description" content="ReactNative使用Code-Push集成热更新">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/2262256-d7a4236da60fc89b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/2262256-5430121357a87bbb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/658">
<meta property="og:updated_time" content="2018-08-18T13:36:56.220Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ReactNative热更新初探">
<meta name="twitter:description" content="ReactNative使用Code-Push集成热更新">
<meta name="twitter:image" content="https://upload-images.jianshu.io/upload_images/2262256-d7a4236da60fc89b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/roee/',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"always","offset":12,"offset_float":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://rjll.gitee.io/roee/2018/04/24/ReactNative热更新初探/"/>





  <title>ReactNative热更新初探 | Roee's Blog</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/roee/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Roee's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/roee/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/roee/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-romantic">
          <a href="/roee/520/romanticPage.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heart"></i> <br />
            
            R❤️W
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/roee/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/roee/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://rjll.gitee.io/roee/roee/2018/04/24/ReactNative热更新初探/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Roee">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/roee/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Roee's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">ReactNative热更新初探</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-04-24T21:20:40+08:00">
                2018-04-24
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/roee/2018/04/24/ReactNative热更新初探/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2018/04/24/ReactNative热更新初探/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="ReactNative使用Code-Push集成热更新"><a href="#ReactNative使用Code-Push集成热更新" class="headerlink" title="ReactNative使用Code-Push集成热更新"></a>ReactNative使用Code-Push集成热更新</h2><p><img src="https://upload-images.jianshu.io/upload_images/2262256-d7a4236da60fc89b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt=""></p>
<a id="more"></a>
<blockquote>
<h3 id="热更新步骤"><a href="#热更新步骤" class="headerlink" title="热更新步骤"></a>热更新步骤</h3></blockquote>
<ul>
<li>1、热更新服务器部署</li>
<li>2、客户端配置</li>
<li>3、客户端热更新代码</li>
<li>4、打包最新代码</li>
<li>5、推送你的新包到客户端</li>
<li><p>6、疑问<br>  Q: “苹果应用商店和android应用商店允不允许使用热更新？”<br>  A: “都允许。”</p>
<blockquote>
<p>苹果允许使用热更新<a href="https://link.jianshu.com/?t=https%3A%2F%2Fdeveloper.apple.com%2Fprograms%2Fios%2Finformation" target="_blank" rel="noopener">Apple’s developer agreement 条款3.3.2</a>, 但是规定不能弹框提示用户更新，影响用户体验。苹果禁的是 rollout.io, JSPatch 这类具备修改原生代码能力的框架。 Google Play也允许热更新，但必须弹框告知用户更新。在中国的android市场发布时，都必须关闭更新弹框，否则会在审核应用时以“请上传最新版本的二进制应用包”驳回应用。</p>
</blockquote>
<p>  Q: “react-native 开发环境更新模式是否可以直接用在生产环境下？”<br><br>  A: “不能。”<br><br>  Q: “code-push使用复杂么？”<br><br>  A: “不复杂。很多网上的文章说复杂，是因为作者没有仔细理解官方文档，而且认为踩坑了。”<br><br>  Q: “为什么推荐code-push？”<br><br>  A: ”非常好。除了满足基本更新功能外，还有统计，hash计算容错和补丁更新功能。微软的项目，大公司技术有保障，而且开源。1.直接对用户部署代码更新2.管理 Alpha，Beta 和生产环境应用3.支持 React Native 和 Cordova4.支持JavaScript 文件与图片资源的更新5.CodePush开源了react-native版本，react-native-code-push托管在GitHub上。</p>
</li>
</ul>
<p>在mac平台上搭建的codepush服务器。</p>
<ul>
<li>安装<a href="https://www.mysql.com/downloads/" target="_blank" rel="noopener">MySQL</a><br><img src="https://upload-images.jianshu.io/upload_images/2262256-5430121357a87bbb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/658" alt=""><br>安装完成后，会弹出初始密码，需要记下来，不要忘记，如果忘记密码，参考以下链接<br><a href="https://blog.csdn.net/u014410695/article/details/50630233" target="_blank" rel="noopener">权限密码问题参考这篇博客</a></li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">将mysql的命令添加到系统中</span><br><span class="line"></span><br><span class="line">(1).进入/usr/local/mysql/bin,查看此目录下是否有mysql</span><br><span class="line">(2).执行vim ~/.bash_profile</span><br><span class="line">    在该文件中添加mysql/bin的目录</span><br><span class="line">    PATH=$PATH:/usr/local/mysql/bin</span><br><span class="line">添加完成后，按esc，然后输入:wq保存。</span><br><span class="line">(3).最后在命令行输入source ~/.bash_profile</span><br><span class="line"></span><br><span class="line">(4). 通过mysql -uroot -p登录mysql, 输入之前保存的密码</span><br><span class="line"></span><br><span class="line">(5).重置mysql初始密码</span><br><span class="line">登录mysql后输入如下命令重置密码：</span><br><span class="line">SET PASSWORD FOR &apos;root&apos;@&apos;localhost&apos; = PASSWORD(&apos;newpassword&apos;);</span><br></pre></td></tr></table></figure>
<ul>
<li>部署code-push-server</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">$ cd 存放code-push-server文件夹</span><br><span class="line">$ git clone https://github.com/lisong/code-push-server.git</span><br><span class="line">$ cd code-push-server</span><br><span class="line">$ npm install</span><br><span class="line">$ vim ./bin/db</span><br><span class="line"></span><br><span class="line"> #别高兴，路漫漫其修远兮</span><br><span class="line"> #初始化mysql  数据库 </span><br><span class="line"> $ ./bin/db init --dbhost localhost --dbuser root --dbpassword xx00(刚刚刚安  装的数据库密码) </span><br><span class="line"> #若错误使用vim编辑器或者subtext修改code-push-server/bin/db里面的默认数据库密</span><br></pre></td></tr></table></figure>
<p>修改配置文件：code-push-server/config/config.js<br><br>如果文件放在七牛上，就修改七牛的配置，本次搭建在电脑本地</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">修改数据库密码就行，端口都不用修改</span><br><span class="line">db: &#123;</span><br><span class="line">username: process.env.RDS_USERNAME || &quot;root&quot;,</span><br><span class="line">password: process.env.RDS_PASSWORD || &apos;gyq123456&apos;,</span><br><span class="line">database: process.env.DATA_BASE || &quot;codepush&quot;,</span><br><span class="line">host: process.env.RDS_HOST || &quot;127.0.0.1&quot;,</span><br><span class="line">port: process.env.RDS_PORT || 3306,</span><br><span class="line">dialect: &quot;mysql&quot;,</span><br><span class="line">logging: false</span><br><span class="line">&#125;,</span><br><span class="line">local: &#123;</span><br><span class="line">// 一些产生的二进制文件会存放在这里，需要你创建文件夹</span><br><span class="line">storageDir:&quot;/Users/chmtech003/Sites/storage&quot;,</span><br><span class="line">// ip，改为你电脑的ip，其他不用换</span><br><span class="line">downloadUrl: &quot;http://192.168.163.108:3000/download&quot;,</span><br><span class="line">// 照着写</span><br><span class="line">public: &apos;/download&apos;</span><br><span class="line">&#125;,</span><br><span class="line">jwt: &#123;</span><br><span class="line">// Recommended: 63 random alpha-numeric characters</span><br><span class="line">// 网址打开: https://www.grc.com/passwords.htm</span><br><span class="line">// 找到63 random alpha-numeric characters 复制放在放在里面就行</span><br><span class="line">tokenSecret:&apos;pq7fHGHvsv3JPZwMZqj79I7eEPvErMUPlM5hFZUyGdPDV9MSQfLZTCLn25sehhR&apos;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<ul>
<li>获取登录token</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">#启动服务 浏览器中打开 http://127.0.0.1:3000</span><br><span class="line"> $ ./bin/www </span><br><span class="line"></span><br><span class="line">#使用 code-push-cli 管理 CodePushServer</span><br><span class="line">$ npm install code-push-cli@latest -g</span><br><span class="line">$ code-push login http://127.0.0.1:3000 #login in browser account:admin password:123456</span><br><span class="line">#登录成功后，将浏览器窗口获取到的token粘贴到需要输入token的终端窗口，登录成功</span><br><span class="line"># code-push logout 登出</span><br><span class="line"></span><br><span class="line"># 修改登录密码方式，不推荐修改，难记</span><br><span class="line">$ curl -X PATCH -H &quot;Authorization: Bearer mytoken&quot; -H &quot;Accept: application/json&quot; -H &quot;Content-Type:application/json&quot; -d &apos;&#123;&quot;oldPassword&quot;:&quot;123456&quot;,&quot;newPassword&quot;:&quot;654321&quot;&#125;&apos; http://127.0.0.1:3000/users/password</span><br></pre></td></tr></table></figure>
<ul>
<li>获取客户端key</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">$ code-push app add 工程名-android #android版</span><br><span class="line">$ code-push app add 工程名-ios #ios版</span><br><span class="line">Successfully added the &quot;HotUpdateDemo-android&quot; app, along with the   following default deployments:</span><br><span class="line">┌────────────┬──────────────────────────────────  ─────┐</span><br><span class="line">│ Name       │ Deployment Key                        │</span><br><span class="line">├────────────┼──────────────────────────────────  ─────┤</span><br><span class="line">│ Production │ Praagnzym0XuijhvH1LRNSdK4kPO4ksvOXqog │</span><br><span class="line">├────────────┼──────────────────────────────────  ─────┤</span><br><span class="line">│ Staging    │ jcgp79y1MT8YSZzPmfs60LbY8vYP4ksvOXqog │</span><br><span class="line">└────────────┴──────────────────────────────────  ─────┘</span><br><span class="line">分别获得iOS和安卓的Deployment Key，推送的时候通过key将app和服务器端关联，推送是分开的，所以iOS，Android分别在项目名后加入后缀区分</span><br><span class="line"></span><br><span class="line"># 命令汇总</span><br><span class="line">$code-push app list 可以查看创建好的APP</span><br><span class="line">$code-push deployment ls &lt;APP_NAME&gt; -k 查看Deployment Key</span><br><span class="line">$code-push app add 在账号里面添加一个新的app</span><br><span class="line">$code-push app remove 或者 rm 在账号里移除一个app</span><br><span class="line">$code-push app rename 重命名一个存在app</span><br><span class="line">$code-push app list 或则 ls 列出账号下面的所有app</span><br><span class="line">$code-push app transfer 把app的所有权转移到另外一个账号</span><br></pre></td></tr></table></figure>
<blockquote>
<p>客户端配置(这里默认已经搭好RN开发环境)</p>
</blockquote>
<ul>
<li>iOS添加Deployment Key</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">在info.plist中添加key</span><br><span class="line">&lt;key&gt;CodePushDeploymentKey&lt;/key&gt;</span><br><span class="line">&lt;string&gt;Deployment Key&lt;/string&gt;</span><br><span class="line">&lt;key&gt;CodePushServerURL&lt;/key&gt;</span><br><span class="line">&lt;string&gt;填入你的电脑IP:eg. http://192.168.0.7:3000&lt;/string&gt;</span><br></pre></td></tr></table></figure>
<ul>
<li>Android添加Deployment Key</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">在MainApplication.java文件中</span><br><span class="line">@Override</span><br><span class="line">protected List&lt;ReactPackage&gt; getPackages() &#123;</span><br><span class="line">  return Arrays.&lt;ReactPackage&gt;asList(</span><br><span class="line">      new MainReactPackage(),</span><br><span class="line">      new CodePush(</span><br><span class="line">       &quot;填入Deployment Key &quot;,</span><br><span class="line">       MainApplication.this,</span><br><span class="line">       BuildConfig.DEBUG,</span><br><span class="line">       &quot;填入你的电脑IP:eg. http://192.168.0.7:3000&quot; </span><br><span class="line">    )</span><br><span class="line">);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>CodePush的API</p>
</blockquote>
<p>测试代码</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Sample React Native App</span></span><br><span class="line"><span class="comment"> * https://github.com/facebook/react-native</span></span><br><span class="line"><span class="comment"> * @flow</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> React, &#123; Component &#125; <span class="keyword">from</span> <span class="string">'react'</span>;</span><br><span class="line"><span class="keyword">import</span> &#123;</span><br><span class="line">  AppRegistry,</span><br><span class="line">  Dimensions,</span><br><span class="line">  Image,</span><br><span class="line">  StyleSheet,</span><br><span class="line">  Text,</span><br><span class="line">  TouchableOpacity,</span><br><span class="line">  Platform,</span><br><span class="line">  View,</span><br><span class="line">&#125; <span class="keyword">from</span> <span class="string">'react-native'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> CodePush <span class="keyword">from</span> <span class="string">"react-native-code-push"</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//var Dimensions = require('Dimensions');</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> instructions = Platform.select(&#123;</span><br><span class="line">  ios: <span class="string">'Press Cmd+R to reload,\n'</span> +</span><br><span class="line">    <span class="string">'Cmd+D or shake for dev menu'</span>,</span><br><span class="line">  android: <span class="string">'Double tap R on your keyboard to reload,\n'</span> +</span><br><span class="line">    <span class="string">'Shake or press menu button for dev menu'</span>,</span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> <span class="class"><span class="keyword">class</span> <span class="title">App</span> <span class="keyword">extends</span> <span class="title">Component</span>&lt;</span>&#123;&#125;&gt; &#123;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">constructor</span>() &#123;</span><br><span class="line">    <span class="keyword">super</span>();</span><br><span class="line">    <span class="keyword">this</span>.state = &#123; <span class="attr">restartAllowed</span>: <span class="literal">true</span> ,</span><br><span class="line">                   syncMessage: <span class="string">"我是小更新"</span> ,</span><br><span class="line">                   progress: <span class="literal">false</span>&#125;;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 监听更新状态</span></span><br><span class="line">  codePushStatusDidChange(syncStatus) &#123;</span><br><span class="line">    <span class="keyword">switch</span>(syncStatus) &#123;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.CHECKING_FOR_UPDATE:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Checking for update."</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.DOWNLOADING_PACKAGE:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Downloading package."</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.AWAITING_USER_ACTION:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Awaiting user action."</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.INSTALLING_UPDATE:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Installing update."</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.UP_TO_DATE:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"App up to date."</span>, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.UPDATE_IGNORED:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Update cancelled by user."</span>, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.UPDATE_INSTALLED:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Update installed and will be applied on restart."</span>, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="keyword">case</span> CodePush.SyncStatus.UNKNOWN_ERROR:</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"An unknown error occurred."</span>, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">  codePushDownloadDidProgress(progress) &#123;</span><br><span class="line">    <span class="keyword">this</span>.setState(&#123; progress &#125;);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 允许重启后更新</span></span><br><span class="line">  toggleAllowRestart() &#123;</span><br><span class="line">    <span class="keyword">this</span>.state.restartAllowed</span><br><span class="line">      ? CodePush.disallowRestart()</span><br><span class="line">      : CodePush.allowRestart();</span><br><span class="line"></span><br><span class="line">    <span class="keyword">this</span>.setState(&#123; <span class="attr">restartAllowed</span>: !<span class="keyword">this</span>.state.restartAllowed &#125;);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 获取更新数据</span></span><br><span class="line">  getUpdateMetadata() &#123;</span><br><span class="line">    CodePush.getUpdateMetadata(CodePush.UpdateState.RUNNING)</span><br><span class="line">      .then(<span class="function">(<span class="params">metadata: LocalPackage</span>) =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: metadata ? <span class="built_in">JSON</span>.stringify(metadata) : <span class="string">"Running binary version"</span>, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">      &#125;, (error: any) =&gt; &#123;</span><br><span class="line">        <span class="keyword">this</span>.setState(&#123; <span class="attr">syncMessage</span>: <span class="string">"Error: "</span> + error, <span class="attr">progress</span>: <span class="literal">false</span> &#125;);</span><br><span class="line">      &#125;);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">/** Update is downloaded silently, and applied on restart (recommended) 自动更新，一键操作 */</span></span><br><span class="line">  sync() &#123;</span><br><span class="line">    CodePush.sync(</span><br><span class="line">      &#123;&#125;,</span><br><span class="line">      <span class="keyword">this</span>.codePushStatusDidChange.bind(<span class="keyword">this</span>),</span><br><span class="line">      <span class="keyword">this</span>.codePushDownloadDidProgress.bind(<span class="keyword">this</span>)</span><br><span class="line">    );</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">/** Update pops a confirmation dialog, and then immediately reboots the app 一键更新，加入的配置项 */</span></span><br><span class="line">  syncImmediate() &#123;</span><br><span class="line">    CodePush.sync(</span><br><span class="line">      &#123; <span class="attr">installMode</span>: CodePush.InstallMode.IMMEDIATE, <span class="attr">updateDialog</span>: <span class="literal">true</span> &#125;,</span><br><span class="line">      <span class="keyword">this</span>.codePushStatusDidChange.bind(<span class="keyword">this</span>),</span><br><span class="line">      <span class="keyword">this</span>.codePushDownloadDidProgress.bind(<span class="keyword">this</span>)</span><br><span class="line">    );</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  render() &#123;</span><br><span class="line"></span><br><span class="line">   <span class="keyword">let</span> progressView;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (<span class="keyword">this</span>.state.progress) &#123;</span><br><span class="line">      progressView = (</span><br><span class="line">        &lt;Text style=&#123;styles.messages&#125;&gt;&#123;<span class="keyword">this</span>.state.progress.receivedBytes&#125; <span class="keyword">of</span> &#123;<span class="keyword">this</span>.state.progress.totalBytes&#125; bytes received&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp">      );</span></span><br><span class="line"><span class="regexp">    &#125;</span></span><br><span class="line"><span class="regexp"></span></span><br><span class="line"><span class="regexp">    return (</span></span><br><span class="line"><span class="regexp">      &lt;View style=&#123;styles.container&#125;&gt;</span></span><br><span class="line"><span class="regexp"></span></span><br><span class="line"><span class="regexp">        &lt;Text style=&#123;styles.welcome&#125;&gt;</span></span><br><span class="line"><span class="regexp">         可以修改此处文字，查看是否更新成功！</span></span><br><span class="line"><span class="regexp">        &lt;/</span>Text&gt;</span><br><span class="line"></span><br><span class="line">        &lt;TouchableOpacity onPress=&#123;<span class="keyword">this</span>.sync.bind(<span class="keyword">this</span>)&#125;&gt;</span><br><span class="line">          &lt;Text style=&#123;styles.syncButton&#125;&gt;Press <span class="keyword">for</span> background sync&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp">        &lt;/</span>TouchableOpacity&gt;</span><br><span class="line"></span><br><span class="line">        &lt;TouchableOpacity onPress=&#123;<span class="keyword">this</span>.syncImmediate.bind(<span class="keyword">this</span>)&#125;&gt;</span><br><span class="line">          &lt;Text style=&#123;styles.syncButton&#125;&gt;Press <span class="keyword">for</span> dialog-driven sync&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp">        &lt;/</span>TouchableOpacity&gt;</span><br><span class="line"></span><br><span class="line">        &#123;progressView&#125;</span><br><span class="line">        </span><br><span class="line">        &lt;TouchableOpacity onPress=&#123;<span class="keyword">this</span>.toggleAllowRestart.bind(<span class="keyword">this</span>)&#125;&gt;</span><br><span class="line">          &lt;Text style=&#123;styles.restartToggleButton&#125;&gt;Restart &#123; <span class="keyword">this</span>.state.restartAllowed ? <span class="string">"allowed"</span> : <span class="string">"forbidden"</span>&#125;&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp">        &lt;/</span>TouchableOpacity&gt;</span><br><span class="line"></span><br><span class="line">        &lt;TouchableOpacity onPress=&#123;<span class="keyword">this</span>.getUpdateMetadata.bind(<span class="keyword">this</span>)&#125;&gt;</span><br><span class="line">          &lt;Text style=&#123;styles.syncButton&#125;&gt;Press <span class="keyword">for</span> Update Metadata&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp">        &lt;/</span>TouchableOpacity&gt;</span><br><span class="line"></span><br><span class="line">        &lt;Text style=&#123;styles.messages&#125;&gt;&#123;<span class="keyword">this</span>.state.syncMessage || <span class="string">""</span>&#125;&lt;<span class="regexp">/Text&gt;</span></span><br><span class="line"><span class="regexp"></span></span><br><span class="line"><span class="regexp">      &lt;/</span>View&gt;</span><br><span class="line">    );</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> styles = StyleSheet.create(&#123;</span><br><span class="line">  container: &#123;</span><br><span class="line">    flex: <span class="number">1</span>,</span><br><span class="line">    alignItems: <span class="string">"center"</span>,</span><br><span class="line">    backgroundColor: <span class="string">"#F5FCFF"</span>,</span><br><span class="line">    paddingTop: <span class="number">50</span></span><br><span class="line">  &#125;,</span><br><span class="line">  image: &#123;</span><br><span class="line">    margin: <span class="number">30</span>,</span><br><span class="line">    width: Dimensions.get(<span class="string">"window"</span>).width - <span class="number">100</span>,</span><br><span class="line">    height: <span class="number">365</span> * (Dimensions.get(<span class="string">"window"</span>).width - <span class="number">100</span>) / <span class="number">651</span>,</span><br><span class="line">  &#125;,</span><br><span class="line">  messages: &#123;</span><br><span class="line">    marginTop: <span class="number">30</span>,</span><br><span class="line">    textAlign: <span class="string">"center"</span>,</span><br><span class="line">  &#125;,</span><br><span class="line">  restartToggleButton: &#123;</span><br><span class="line">    color: <span class="string">"blue"</span>,</span><br><span class="line">    fontSize: <span class="number">17</span></span><br><span class="line">  &#125;,</span><br><span class="line">  syncButton: &#123;</span><br><span class="line">    color: <span class="string">"green"</span>,</span><br><span class="line">    fontSize: <span class="number">17</span></span><br><span class="line">  &#125;,</span><br><span class="line">  welcome: &#123;</span><br><span class="line">    fontSize: <span class="number">20</span>,</span><br><span class="line">    textAlign: <span class="string">"center"</span>,</span><br><span class="line">    margin: <span class="number">20</span></span><br><span class="line">  &#125;,</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<blockquote>
<p>热更新操作</p>
</blockquote>
<ul>
<li>最简单的方式</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">cd ./工程目录</span><br><span class="line">测试环境执行：</span><br><span class="line">$ code-push release-react 项目名-android android</span><br><span class="line">生产环境执行：</span><br><span class="line">$ code-push release-react 项目名-android android -d Production</span><br><span class="line">一直没成功过，不知道为什么，这种一句命令的更新超级简单，适不适用，待考虑</span><br></pre></td></tr></table></figure>
<ul>
<li>通过上传包来进行更新</li>
</ul>
<p><strong>离线包</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$ cd ./工程目录</span><br><span class="line"> $ mkdir bundles</span><br><span class="line"> $ react-native bundle --platform 平台 --entry-file 启动文件 --bundle-output 打包js输出文件 --assets-dest 资源输出目录 --dev 是否调试。</span><br><span class="line"> eg.</span><br><span class="line"> $react-native bundle --platform ios --entry-file index.js --bundle-output ./ios/bundles/main.jsbundle --dev false</span><br></pre></td></tr></table></figure>
<p><strong>发布更新</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ code-push release &lt;应用名称&gt; &lt;Bundles所在目录&gt; &lt;对应的应用版本&gt; --deploymentName： 更新环境 --description： 更新描述 --mandatory： 是否强制更新 </span><br><span class="line">code-push release HotUpdateDemo-ios ./ios/bundles/main.jsbundle 1.0.0 --deploymentName Production --description &quot;我是新包，很新的那种&quot; --mandatory true</span><br></pre></td></tr></table></figure>
<hr>
<h2 id="完结，撒花🎉"><a href="#完结，撒花🎉" class="headerlink" title="完结，撒花🎉"></a>完结，撒花🎉</h2>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/roee/tags/ReactNative/" rel="tag"># ReactNative</a>
          
            <a href="/roee/tags/JavaScript/" rel="tag"># JavaScript</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/roee/2018/04/13/在hexo博客中插入本地图片的方法/" rel="next" title="在hexo博客中插入本地图片的方法">
                <i class="fa fa-chevron-left"></i> 在hexo博客中插入本地图片的方法
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/roee/2018/05/19/iOS加载bmp位图/" rel="prev" title="iOS加载bmp位图">
                iOS加载bmp位图 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/roee/images/avatar.jpg"
               alt="Roee" />
          <p class="site-author-name" itemprop="name">Roee</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/roee/archives/">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/roee/tags/index.html">
                <span class="site-state-item-count">8</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/llMrRongll" target="_blank" title="github">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                    
                      github
                    
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#ReactNative使用Code-Push集成热更新"><span class="nav-number">1.</span> <span class="nav-text">ReactNative使用Code-Push集成热更新</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#热更新步骤"><span class="nav-number">1.1.</span> <span class="nav-text">热更新步骤</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#完结，撒花🎉"><span class="nav-number">2.</span> <span class="nav-text">完结，撒花🎉</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Roee</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Gemini
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/roee/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/roee/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/roee/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/roee/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/roee/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/roee/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/roee/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/roee/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/roee/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/roee/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/roee/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/roee/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/roee/js/src/bootstrap.js?v=5.1.2"></script>



  


  

    
      <script id="dsq-count-scr" src="https://roee-1.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://rjll.gitee.io/roee/2018/04/24/ReactNative热更新初探/';
          this.page.identifier = '2018/04/24/ReactNative热更新初探/';
          this.page.title = 'ReactNative热更新初探';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://roee-1.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  








  





  

  

  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
